<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>车辆基础资料</title>
<link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

 /* function submit(deleteId){
	  $(".sure").click(function(){
	  $(".tip").fadeOut(100);
	  location='deleteCarByFid?deleteId='+deleteId+'';
	  })

	  $(".cancel").click(function(){
		  $(".tip").fadeOut(100);
		});

	  }
 $(document).ready(function(){

	 $(".tablelink").click(function(){
		  $(".tip").fadeIn(200);
	 });

	$(".tiptop a").click(function(){
		  $(".tip").fadeOut(200);
	});


	  $("#addCar").click(function(){
	   location="insertCar";
	   });

	}); */

</script>
<style type="text/css">
.seachform li label{line-height: 45px;color: #444444	}
.scinput{line-height: 10px;margin-top: 5px}
.scinput1{margin-top: 5px;height: 30px;}
.scbtn{background: #57a0ff;border-radius:20px;width: 110px;margin-top: 4px;height: 35px}
.scbtn2{height: 20px;background: #57a0ff;border-radius:20px;width: 50px;color: #fff;display: none;}
{}
.tablelist th{background: none;border-bottom: none;}
thead {background: #f2f2f2}
tbody tr:nth-child(even) {background: #f7f8fd}
.tablelist th{height: 45px;padding-left: 30px}
.tablelist td{border-right:none;padding-left: 30px}
tbody tr{height: 38px}
.check{padding-left: 0px}
a{cursor: pointer;}

</style>
</head>
<body style="background: #f5f5f5;padding: 0 10px;">
<div id="location_top">
		<div class="place" style="background: #f5f5f5;margin-top: 10px">
			<ul class="placeul">
				<li><a href="#">学员管理</a></li>
				<li><a href="#">转班申请</a></li>
			</ul>
		</div>

		<div class="rightinfo" style="background: #fff;border-radius:10px;height: 45px;">

			<form action="<%=path%>/DrivingSys/selectChangeClazzByCon" method="post">
				<ul class="seachform">
						<li style="display: none"><input type="text" name="outList" id="outList" value=""></li>
					    <li><label>学员名称</label><input name="studentName" type="text" class="scinput" value="${changeClazz1.studentName}"/></li>
					    <li><label>身份证号码</label><input name="cfidcardno" type="text" class="scinput" value="${changeClazz1.cfidcardno}"/></li>
					    <li><label>电话</label><input name="cfmobile" type="text" class="scinput" value="${changeClazz1.cfmobile}"/></li>
					    <li><label>业务开始时间</label><input class="scinput1"  name="beginTime" type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',dateFmt:'yyyy-MM-dd'})"
					    id="datemin" class="input-text Wdate" style="width:150px;" value="${beginTime}"></li>
						<li><label>业务结束时间</label><input class="scinput1"  name="endTime" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',dateFmt:'yyyy-MM-dd'})"
						id="datemax" class="input-text Wdate" style="width:150px;"value="${endTime}"></li>
						<li><label>&nbsp;</label><input name="" type="submit"  style="outline: none;" class="scbtn" value="立即查询" /></li>

				</ul>
			</form>
		</div>
</div>
<div id="data_table_new"
	 style="margin-bottom: 0px;margin-top: 30px;background: #fff;border-radius:10px;box-shadow: 0 0 10px #f2f2f2;">
			<ul>
				 <li style="height: 40px;text-align: left;color: #999999;">
				  <span style="font-size: 12px;">
				  <shiro:hasPermission name="/addChangeClazz">
				  <img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;" src="<%=path%>/images/list/xz.png">
				       &nbsp;<a onclick="gotoSelectCard(this)" funurl="<%=path%>/DrivingSys/addChangeClazz">新增</a>
				  </shiro:hasPermission>
				  <shiro:hasPermission name="/delChangeClazzById">
				  <img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;" src="<%=path%>/images/list/sc.png">
				       &nbsp;<a class="del">删除</a>
				  </shiro:hasPermission>
				  <shiro:hasPermission name="/selChangeClazzById">
				  <img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;" src="<%=path%>/images/list/xg.png">
				       &nbsp;<a class="update">修改</a>
				  </shiro:hasPermission>
					<shiro:hasPermission name="/outChangeClazzExcel">
					<img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;width: 14px" src="<%=path%>/images/list/excel.png">
					  &nbsp;<a class="outChangeClazzExcel">导出Excle</a>
					</shiro:hasPermission>
					<shiro:hasPermission name="/outChangeClazzExcel">
						<img alt="" style="margin-top: 20px;margin-left: 22px;height: 12px;width: 14px" src="<%=path%>/images/list/process.jpg">
						&nbsp;<a style="margin-top: 20px;" class="checkProcess">查看流程图</a>
					</shiro:hasPermission>
					  	<a  style="margin-left: 20px">字段筛选：</a><select id="ddlLine" class="easyui-combotree" style="width: 205px; height: 24px;"></select>
				  </span>
				 </li>
			</ul>




	<table class="tablelist" style="white-space:nowrap;">
			<thead>
				<tr>
					<th><input type="checkbox" class="check" /></th>
					<th id="1">单据编号</th>
					<th id="2">业务日期</th>
					<th id="3">备注</th>
					<th id="4">审核人名称</th>
					<th id="5">制单人名称</th>
					<th id="6">学员</th>
					<th id="7">学员编码</th>
					<th id="8">身份证号码</th>
					<th id="9">手机</th>
					<th id="10">单据状态</th>
					<th id="11">电话</th>
					<th id="12">性别</th>
					<th id="13">入学日期</th>
					<th id="14">当前班级</th>
					<th id="15">当前班级金额</th>
					<th id="16">转入班级</th>
					<th id="20">车型</th>
					<th id="17">转入班级金额</th>
					<th id="18">转入班级规费</th>
					<th id="19">转入班级培训费</th>
					<th >操作</th>
				</tr>
			</thead>
			<c:forEach items="${changeClazzs}" var="changeClazz" varStatus="s">
				<tr class="student">
					<td><input type="checkbox"  value="${changeClazz.fid}" name="check"/></td>
					<td class="1">${changeClazz.fnumber}</td>
					<td class="2">${changeClazz.fbizdate}</td>
					<td class="3">${changeClazz.fdescription}</td>
					<td class="4">${changeClazz.fauditorName}</td>
					<td class="5">${changeClazz.fcreateName}</td>
					<td class="6">${changeClazz.studentName}</td>
					<td class="7">${changeClazz.cfstudentno}</td>
					<td class="8">${changeClazz.cfidcardno}</td>
					<td class="9">${changeClazz.cfmobile}</td>
					<c:if test="${changeClazz.cfbillstate eq 5}">
						<td class="10">审核</td>
					</c:if>
					<c:if test="${changeClazz.cfbillstate eq 4}">
						<td class="10">提交</td>
					</c:if>
					<c:if test="${changeClazz.cfbillstate eq 3}">
						<td class="10">保存</td>
					</c:if>
					<td class="11">${changeClazz.cfphone}</td>
					<c:if test="${changeClazz.cfsex eq 1}">
					<td class="12">男</td>
					</c:if>
					<c:if test="${changeClazz.cfsex eq 2}">
					<td class="12">女</td>
					</c:if>
					<c:if test="${changeClazz.cfsex ne 2 && changeClazz.cfsex ne 1}">
					<td></td>
					</c:if>
					<td class="13">${changeClazz.cfrxrq}</td>
					<td class="14">${changeClazz.cfcurrentclassName}</td>
					<td class="15">${changeClazz.cfamount}元</td>
					<td class="16">${changeClazz.cfzrbjName}</td>
					<td class="19">${changeClazz.cfslzjcxdh}</td>
					<td class="17">${changeClazz.cfbjje}元</td>
					<td class="18">${changeClazz.cfguifei}元</td>
					<td class="19">${changeClazz.cfpxf}元</td>
					<td>
					   <img alt="" height="11px" src="<%=path%>/images/list/xg.png">
						<a href="<%=path%>/DrivingSys/selChangeClazzById?fid=${changeClazz.fid}" class="tablelink">查看</a>&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;<img alt="" height="11px" src="<%=path%>/images/list/sc.png">
						<a onclick="delStudent('${changeClazz.fid}',this)" class="tablelink">删除</a>&nbsp;&nbsp;&nbsp;
				    </td>
				</tr>
			</c:forEach>
			<%--rhc  信息总条数--%>
			<tr class="sq">
				<td>合计:</td>
				<td>${messageAmount}</td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
		</table>
		</div>
<div id="location_bottom">
		<pg:pager items="${pb.tr}" url="${pb.url}" export="offset,currentPageNumber=pageNumber" maxPageItems="${pb.ps}">
			   <pg:param name="studentName" value="${changeClazz1.studentName}"/>
    		   <pg:param name="cfmobile" value="${changeClazz1.cfmobile}"/>
    		   <pg:param name="cfidcardno" value="${changeClazz1.cfidcardno}"/>
    		   <pg:param name="beginTime" value="${beginTime}"/>
    		   <pg:param name="endTime" value="${endTime}"/>
            <pg:index>
               <pg:first>
               <a href="${pageUrl}&&type=${type}" >
               <nobr>
               [首页]
               </nobr>
              </a>
               </pg:first>
               <pg:prev><a href="${pageUrl}&&type=${type}">前一页</a></pg:prev>
               <pg:pages>
                     <c:choose>
                        <c:when test="${currentPageNumber eq pageNumber}">
                           <font color="red">${pageNumber }</font>
                        </c:when>
                        <c:otherwise>
                           <a href="${pageUrl}&&type=${type}">${pageNumber}</a>
                        </c:otherwise>
                     </c:choose>
               </pg:pages>
               <pg:next><a href="${pageUrl}&&type=${type}">下一页</a></pg:next>
               <pg:last><a href="${pageUrl}&&type=${type}"><nobr>[尾页]</nobr></a></pg:last>
            </pg:index>
         </pg:pager>
</div>
		<div class="tip">
			<div class="tiptop">
                <span>提示信息</span>
			</div>
			<div class="tipinfo">
				<span><img src="<%=path%>/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认对信息删除 ？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button" class="sure" value="确定" />&nbsp; <input
					name="" type="button" class="cancel" value="取消" />
			</div>
		</div>





</body>
<script type="text/javascript" src="<%=path%>/JS/tempJs/tool.js"></script>
<script type="text/javascript">

	var outs=[];
    $(function () {
        // $(".tip").css("left",$(".tablelist").width()-1000)

        <%
        ArrayList<String>  arr=(ArrayList<String>) request.getSession().getAttribute("outlist");
        System.out.println(arr);
        %>
		outs=<%=arr%>;
        if(outs!=null&&outs!=[]){
            showList(outs)
        }
        $('#ddlLine').combotree({
            valueField: "id", //Value字段
            textField: "text", //Text字段
            multiple: true,
            data: [{ "id": 17, "text": "全选", "children": [{ "id": 1, "text": "单据编号" }, { "id": 2, "text": "业务日期" },
					{ "id": 3, "text": "备注"}, { "id": 4, "text": "审核人名称" }, { "id": 5, "text": "制单人名称" }, { "id": 6, "text": "学员" }
                    , { "id": 7, "text": "学员编码" }, { "id": 8, "text": "身份证号码" }, { "id": 9, "text": "手机" }, { "id": 10, "text": "单据状态" }
                    , { "id": 11, "text": "电话" }, { "id": 12, "text": "性别" }, { "id": 13, "text": "入学日期" }, { "id": 14, "text": "当前班级" }
                    , { "id": 15, "text": "当前班级金额" }, { "id": 16, "text": "转入班级" }, { "id": 17, "text": "转入班级金额" }]}]
            ,
            //                url: "tree_data2.json", //数据源
            onCheck: function (node, checked) {
                //让全选不显示
                var valueOne = $('#ddlLine').combotree('getValues');
                var valueTow=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];
                var flag=true;
                var outl=[];
                for(var i=0;i<valueTow.length;i++){
                    flag=true;

                    for(var j=0;j<valueOne.length;j++){
                        if(valueTow[i]==valueOne[j]){ // 如果数据能保证id和name一直配对，则可以少一个比较条件
                            flag = false;
                            break;
                        }
                    }
                    if(flag){

                        $("#"+valueTow[i]).css("display","none")
                        $("."+valueTow[i]).css("display","none")
                    }else{
                        outl.push(valueTow[i])
                        $("#"+valueTow[i]).css("display","")
                        $("."+valueTow[i]).css("display","")
                    }
                }
                $("#outList").val(outl);
                var obj=new Object();
                obj.outList=outl
                $.ajax({
                    url:'<%=path%>/DrivingSys/OutList',
                    data: JSON.stringify(obj),
                    type:"post",
                    dataType:'json',
                    contentType: 'application/json;charset=UTF-8',
                    success: function (res) {
					}

                })
                console.log(outl)
                $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
            },
            onClick: function (node, checked) {
                //让全选不显示
                $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
            }
        });

    })



	function showList(outs){
        var valueOne =outs;
        var valueTow=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];
        var flag=true;
        for(var i=0;i<valueTow.length;i++){
            flag=true;
            for(var j=0;j<valueOne.length;j++){
                if(valueTow[i]==valueOne[j]){ // 如果数据能保证id和name一直配对，则可以少一个比较条件
                    flag = false;
                    break;
                }
            }
            if(flag){
                $("#"+valueTow[i]).css("display","none")
                $("."+valueTow[i]).css("display","none")
            }else{
                $("#"+valueTow[i]).css("display","")
                $("."+valueTow[i]).css("display","")
            }
        }

	}







	$(document).ready(function(){

        fixation_List()
        var type = "${type}";
            if (type == '0' || type == '' || type == null) {

            } else {
                //alert("添加成功");
                editAlert();
            }

       /* $('input:checkbox:not(":first")').each(function(i){
            if($(this).parent().parent().find('td:nth-child(11)').html() == '审核' || $(this).parent().parent().find('td:nth-child(11)').html() == '提交' ) {
                $(this).attr('disabled', true)
            }
        })*/

		$('.del').click(function(){
            var spCodesTemp = "";
            var flag = 0
            $('[name=check]:checked').each(function(i){
                if($(this).parent().parent().find('td:nth-child(11)').html() == '审核' || $(this).parent().parent().find('td:nth-child(11)').html() == '提交' ){
                    flag=1
                    $(this).attr('checked',false)
                }else {
                    if(0==i){
                        spCodesTemp = $(this).val();
                    }else{
                        spCodesTemp += (","+$(this).val());
                    }
                }
            });

            if(flag == 1){
                alert("提交或审核状态不能被删除")
            }else if(spCodesTemp==""){
                alert("请选择单据")
            }else{
                $(".tip").fadeIn(100);
                $(".sure").click(function(){
                    location = '<%=path%>/DrivingSys/delChangeClazzById?fid=' + spCodesTemp;
                    $(".tip").fadeOut(100);
                })
            }

            $(".cancel").click(function(){
					  $(".tip").fadeOut(100);
					});

		})

		$('.student').live('dblclick',function(){
		 var fid=$(this).find('input:checkbox').val()
		 fid=fid.replace(/\+/g,"%2B");
            gotoSelectCard(this,'/DrivingSys/selChangeClazzById?fid='+fid);
            //location.href='<%=path%>/DrivingSys/selChangeClazzById?fid='+fid
		})


		$('.update').click(function(){
			var spCodesTemp = "";
            $('[name=check]:checked').each(function(i){
		       if(0==i){
		        spCodesTemp = $(this).val();
		       }else{
		        spCodesTemp += (","+$(this).val());
		       }
		      });
		      if(spCodesTemp==""){
		    	  alert("请选择学员")
		      }else{
		      var fid=spCodesTemp.split(",")[0]
		      		fid=fid.replace(/\+/g,"%2B");
		      location.href='<%=path%>/DrivingSys/selChangeClazzById?fid='+fid
		      }
		})

        $(".checkProcess").live('click',function(){
            var spCodesTemp = "";
            $('[name=check]:checked').each(function(i){
                if(0==i){
                    spCodesTemp = $(this).parent().next().text();
                }else{
                    spCodesTemp += (","+$(this).parent().next().text());
                }
            });
            if(spCodesTemp==""){
                alert("请选择单据")
            }else{
                var fnumber=spCodesTemp.split(",")[0]
                fnumber=fnumber.replace(/\+/g,"%2B");
                lookActivitiImg('publicProcess',fnumber)
            }

        })


        /* 全选功选 */
			$('.check').click(function(){
				if($(this).attr("checked")){
                    $('input:checkbox:not(":first")').each(function() {
                        if(typeof($(this).attr('disabled')) == 'undefined'){
                             $(this).prop("checked", true)
                        }
                    })
				}else{
					$('input:checkbox').removeAttr('checked')
				}
			})
			})

			function delStudent(deleteId,_this){
	         var $this = $(_this)
                if($this.parent().parent().find('td:nth-child(11)').html() == '审核' || $this.parent().parent().find('td:nth-child(11)').html() == '提交'){
                    alert($this.parent().parent().find('td:nth-child(11)').html()+'状态不能删除')
                    return false
	         } else {
                    $(".tip").animate(({top: $(window).scrollTop()+250}))
                    $(".tip").fadeIn(200);
                    $('.window-mask').fadeToggle()
                    $(".sure").click(function () {
                        $(".tip").fadeOut(100);
                        $('.window-mask').fadeOut()
                        location = '<%=path%>/DrivingSys/delChangeClazzById?fid=' + deleteId + '';

                    })
                }
			$(".cancel").click(function(){
                $('.window-mask').fadeOut()
			  $(".tip").fadeOut(100);
			});

			}


			$('.outChangeClazzExcel').live('click',function () {
                var studentName = $('.seachform').find('input[name=studentName]').val()
                var cfmobile = $('.seachform').find('input[name=cfmobile]').val()
                var cfidcardno = $('.seachform').find('input[name=cfidcardno]').val()
                var beginTime = $('.seachform').find('input[name=beginTime]').val()
                var endTime = $('.seachform').find('input[name=endTime]').val()
                location = '<%=path%>/DrivingSys/outChangeClazzExcel?studentName='+ studentName + '&cfidcardno=' + cfidcardno + '&cfmobile=' + cfmobile + '&beginTime=' + beginTime + '&endTime=' + endTime
            })
</script>
</html>